/*
 * GameStartedSubStateController.h
 *
 *  Created on: Dec 27, 2011
 *      Author: rudi
 */

#ifndef GAMESTARTEDSUBSTATECONTROLLER_H_
#define GAMESTARTEDSUBSTATECONTROLLER_H_
#include "IGameStateController.h"
#include "NetworkEventData.h"

// TODO: Rename this class to IGameStartedSubStateController
// TODO: Rename getSubstateId to getSubStateId

class GameStartedGameStateController;

/**
 * This class handles the states after the the game is started
 *
 * Currently there are only two SubState classes: LocalTurn and RemoteTurn
 * @see LocalTurnSubstateController
 * @see RemoteTurnSubStateController
 * @see IGameStateController
 * @author Rudolf Heszele heszele@gmail.com
 * @version 1.0
 * @since 2012-03-08
 */
class GameStartedSubStateController: public IGameStateController
{
	public:
		/**
		 * Enum for listing every kind of SubState controllers
		 */
		enum SubstateId
		{
			LOCAL_TURN,
			REMOTE_TURN,
		};
		/**
		 * The default constructor initializes the mGameStartedController variable to NULL
		 */
		GameStartedSubStateController();
		virtual ~GameStartedSubStateController();
		/**
		 * Method to determine the type of the SupState object. Every inherited class needs to implement this method
		 *
		 * @return The SubstateId of the object
		 */
		virtual SubstateId getSubstateId() = 0;
		/**
		 * Method to fetch the next SubState of the game. Every inherited class needs to implement this method
		 *
		 * @return The next SubState of the game
		 */
		virtual GameStartedSubStateController* getNextSubStateController() = 0;
		void addGameStartedController(GameStartedGameStateController* gameStartedController);

	protected:
		/**
		 * Helper method to send data packets to the remote side
		 *
		 * Since this method is used only after the game is started, itis mainly used to send mouse movemet related packets.
		 * @see NetworkEventData
		 * @param dataType The type of the packet
		 * @param position The position of the mouse
		 */
		void sendDataToRemoteSide(NetworkEventData::DataType dataType, const wxPoint& position);

		/**
		 * The GameStartedController the SubStateController belongs to
		 */
		GameStartedGameStateController* mGameStartedController;
};

inline void GameStartedSubStateController::addGameStartedController(GameStartedGameStateController* gameStartedController)
{
	mGameStartedController = gameStartedController;
}

#endif /* GAMESTARTEDSUBSTATECONTROLLER_H_ */
